﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_GetTotalStaff]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_GetTotalStaff];
GO
CREATE PROCEDURE [dbo].[sproc_GetTotalStaff]
/*

====================================================
功能:    得到所有的人员
    
====================================================

*/
AS
    SELECT A.*,datediff(yy,a.birthday,getdate()) as Age,(case sex when 1 then '男' else '女' end) as SexName,Convert(nvarchar(10),A.RegistedDate,120) AS RQ,(SELECT Position_name FROM uds_Position WHERE Position_id = b.Position_id) AS Position_Name
        FROM uds_staff A,uds_staff_in_position b
        WHERE a.staff_id = b.staff_id
        ORDER BY A.RegistedDate DESC